import { Flex } from '@aws-amplify/ui-react';
import { Example, ExampleCode } from '@/components/Example';
import { ThemeAlert } from '@/components/ThemeAlert';
import { BasicExample, CustomThemeExample } from './examples';
## Usage
Import the `ThemeProvider` and wrap your application with it:
```jsx
import { ThemeProvider } from '@aws-amplify/ui-react';
export const App = () => (
);
```
After wrapping your application in the `ThemeProvider`, you have access to all theme values in your components. To style the components in your app, you can either:
1. Get the theme `tokens` through the `useTheme` hook (e.g., `tokens.colors.blue[80]`)
2. Reference the theme `tokens` directly in style props (e.g., `"purple.80"`)
```tsx file=./examples/BasicExample.tsx
```
### theme
To create and use your own custom theme, you may pass a [theme object](https://ui.docs.amplify.aws/react/theming#theme-object) to the `theme` prop on the `ThemeProvider`.
- [Theming overview](/theming)
```tsx file=./examples/CustomThemeExample.tsx
```
### colorMode
The `ThemeProvider` accepts a `colorMode` prop which can be `light`, `dark`, or `system`.
See the [Dark mode documentation](./dark-mode) for a detailed explanation of how to use the `colorMode` prop.
### nonce
When you have a `Content-Security-Policy` ([CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)) header defined, the browser will automatically block inline styles.
To safely allow inline styles when using strict CSP rules, you may pass a [nonce](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) to the `nonce` prop on the `ThemeProvider`. This will add a nonce to the `
```
For more information, see the following documention on [allowing inline styles using a nonce](https://content-security-policy.com/examples/allow-inline-style/).